package com.pbc.gmp.action;

import com.pbc.gmp.model.LoginUserInfo;
import com.pbc.gmp.model.MenuTreeResourseDto;
import com.pbc.gmp.service.impl.MenuResServiceImpl;
import com.pbc.gmp.service.impl.MenuTreeService;
import com.xiaoleilu.hutool.convert.Convert;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by UPC on 2017/4/20.
 */
@Controller
@RequestMapping("/resource")
public class ResourceAction {
    @Autowired
    private MenuResServiceImpl menuResService;
    private List<MenuTreeResourseDto> menutreeDto;
    @Autowired
    private MenuTreeService menuTreeService;
    /**
     * 菜单树
     *
     * @return
     */
    @PostMapping("/tree")
    @ResponseBody
    public Object tree() {
        LoginUserInfo userInfo= (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
//        List<MenuTreeResourseDto> menus=menuTreeService.selectLeftMenuTreeByUserId(Convert.toLong(1));
        return userInfo.getMenus();
    }

}
